import 'package:flutter/material.dart';
import 'package:pwd_keeper/global.dart';
import 'package:pwd_keeper/iconfont.dart';
import 'package:pwd_keeper/pages/pwd/index.dart';
import 'package:titled_navigation_bar/titled_navigation_bar.dart';

class IndexPage extends StatefulWidget {
  IndexPage({Key key}) : super(key: key);
  @override
  _IndexPageState createState() => _IndexPageState();
}

class _IndexPageState extends State<IndexPage> {
  int _currentIndex = 0;
  PageController _pageController;

  @override
  void initState() {
    super.initState();
    _pageController = PageController();
  }

  @override
  void dispose() {
    _pageController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SizedBox.expand(
        child: PageView(
          controller: _pageController,
          onPageChanged: (index) {
            setState(() => _currentIndex = index);
          },
          children: <Widget>[
            PwdKeeperIndexPage(),
            // Container(
            //   color: Colors.blue,
            // ),
          ],
        ),
      ),
      // bottomNavigationBar: TitledBottomNavigationBar(
      //   currentIndex: _currentIndex,
      //   reverse: true,
      //   enableShadow: false,
      //   activeColor: Global.fontColor,
      //   onTap: (index) {
      //     setState(() => _currentIndex = index);
      //     _pageController.jumpToPage(index);
      //   },
      //   items: [
      //     TitledNavigationBarItem(
      //       title: Text(
      //         '密码管理',
      //         style: TextStyle(
      //           color: Global.fontColor,
      //           fontSize: 13,
      //           fontWeight: FontWeight.w600,
      //         ),
      //       ),
      //       icon: IconFont.mima,
      //     ),
      //     TitledNavigationBarItem(
      //       title: Text(
      //         '备忘夹',
      //         style: TextStyle(
      //           color: Global.fontColor,
      //           fontSize: 13,
      //           fontWeight: FontWeight.w600,
      //         ),
      //       ),
      //       icon: IconFont.opr_list,
      //     ),
      //   ],
      // ),
    );
  }
}
